
import {useEffect, useState} from "react";
import {getChannelsAPI} from "@/apis/ArticleAPI";
// 频道列表
function useChannels() {
    const [channels, setChannels] = useState([])

    useEffect(() => {
        async function fetchChannelsList() {
            // 获取频道列表
            // const res = await request.get('/channels')
            const res = await getChannelsAPI()
            setChannels(res.data.channels)
        }

        fetchChannelsList()
    }, []);
    return {channels}
}

export {useChannels}